Conversation
…for random oracle proofs - QueryCache: partial order, simp lemmas (empty, cacheQuery), sum spec projections (fst/snd/inl/inr), membership, extensionality - PreservesInv: composition lemma for oracle transformers, bind lemma for StateT invariant preservation - CachingOracle: cache monotonicity (withCaching_cache_le) and PreservesInv instance showing the cache only grows Made-with: Cursor
🤖 AI-Generated PR SummaryFiles Changed:
Overview of Changes: This diff introduces a formal framework for reasoning about the monotonic growth of query caches and enhances the tools for proving state-based invariants.
New 'sorry's: 0 |
Use a local `omit [LawfulMonad m]` on `QueryImpl.apply_compose` so the build stays warning-clean except for existing `sorry` declarations. Made-with: Cursor
…ation Prove that running an oracle computation with a seeded oracle (backed by a randomly generated seed) preserves the output distribution, i.e. sampling a seed and simulating queries is equivalent to real oracle calls. Key additions: - QuerySeed.pop, prependValues helpers and injectivity lemma (Structures) - probOutput_generateSeed_prependValues factorization lemma (GenerateSeed) - evalDist_generateSeed_eq_of_countEq seed normalization (GenerateSeed) - probOutput_generateSeed_bind_simulateQ_bind main theorem (SeededOracle) - Union bound lemma probEvent_exists_finset_le_sum (EvalDist/Fintype) Made-with: Cursor
… and EvalDist/BitVec Both files contained lemmas generic over any `m` with `[HasEvalSPMF m]` but incorrectly imported from OracleComp, violating the EvalDist → OracleComp layering. List.lean needed no split — just import and namespace fixes. BitVec.lean's SampleableType instance moved to SampleableType.lean. README updated to fix outdated notation (++ₒ→+, [=x|]→Pr[=x|], etc.). Made-with: Cursor
… bound Extend Fork.lean with seed-slot collision probability bounds and the global collision penalty lemma, then wire these into le_probOutput_fork while leaving the final seed-factor/square step explicitly marked for continuation. Made-with: Cursor
Add agent guidance to keep unfinished Lean proof structure with local `stop` checkpoints instead of deleting blocks, so later iterations can continue from prior search context. Made-with: Cursor
Adopt independence as the canonical perfect-secrecy definition with equivalent formulations, so privacy statements align with textbook semantics and are easier to reuse. Prove one-time-pad privacy against the new notion and document the updated proof status.
Add reusable perfect-secrecy experiment decomposition lemmas and complete the backward Shannon direction constructively. Make the forward direction explicit via a passed hypothesis so the theorem family is fully sorry-free while keeping proof obligations transparent.
Replace the misleading Shannon iff path with an explicit constructive theorem over `perfectSecrecyAt`, and add the stronger PMF-prior theorem that proves uniform+unique implies all-priors secrecy. This keeps theorem semantics honest while preserving reusable proof helpers.
- Extract ENNReal Cauchy-Schwarz inequalities to ToMathlib/Data/ENNReal/SumSquares.lean - Factor out cipherGivenMsg_uniform_of_uniformKey_of_uniqueKey in SymmEncAlg.lean, derive both Shannon theorems and ciphertextRowsEqualAt from it - Remove unused perfectSecrecyAt_iff_allDefs / perfectSecrecy_iff_allDefs lemmas - Move XOR probability lemmas to OracleComp/Constructions/BitVec.lean - Add generic probEvent_liftComp_uniformSample_eq_of_eq helper in SeededOracle.lean, simplify seed-slot collision lemmas in Fork.lean - Extract length_eq_of_mem_support_generateSeed to deduplicate repeated blocks Net -150 lines. Made-with: Cursor
Delete ~390 lines of old forking lemma code that used obsolete API (guard, getM, [= x | ...] notation, s+1 index bug). All theorem statements are now covered by the active uncommented code. Made-with: Cursor
Summary
This PR builds three main pillars needed for random oracle model proofs and game-hopping arguments: a complete perfect secrecy framework with Shannon's theorem, significant progress on the forking lemma, and distribution-preservation proofs for seeded oracles.
Key Changes
SymmEncAlg.lean)perfectSecrecyAtdefinition asPr[(M,C)] = Pr[M] * Pr[C]; equivalent formulations (posterior/prior, joint factorization, channel-level); constructive Shannon theorems (perfectSecrecyAt_of_uniformKey_of_uniqueKey,perfectSecrecyAtAllPriors_of_card_eq_of_uniform_unique) — all sorry-freeOneTimePad.lean)oneTimePad.perfectSecrecyproved via XOR uniformity — sorry-freeFork.lean)cf_eq_of_mem_support_fork(fork-index agreement) fully proved;le_probOutput_forkper-index lower bound proved modulo 1 sorry + 1 stop checkpoint;probOutput_none_fork_lemain bound proved assumingle_probOutput_forkSeededOracle.lean,GenerateSeed.lean)evalDist_liftComp_generateSeed_bind_simulateQ_run'— random seed + seeded simulation preserves distributions — fully provedOracleComp/Constructions/BitVec.lean)probOutput_xor_uniform,probOutput_pair_xor_uniform,probOutput_cipher_from_pair_uniformToMathlib/Data/ENNReal/SumSquares.lean)sq_sum_le_card_mul_sum_sqfor collision boundsEvalDist/BitVec.lean,EvalDist/List.lean)OracleCompimports; lemmas now generic overHasEvalSPMFStructures.lean)pop, extendedprependValues,length_eq_of_mem_support_generateSeedAGENTS.md,README.md)Proof Status
SymmEncAlg.leanOneTimePad.leanFork.leanstople_probOutput_forkseed-factor stepSeededOracle.leanGenerateSeed.leanTesting
lake exe mk_all --checkpasses (import ordering clean)lake buildpasses with no new warnings (except existingsorrydeclarations)